package utilitarios;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

@SuppressWarnings("deprecation")
public class SessaoFactory {
	public static Session sessao;
	
	public static Session getSession() {
		if(sessao == null){
			AnnotationConfiguration configuration = new AnnotationConfiguration();
			configuration.configure();
			SessionFactory factory = configuration.buildSessionFactory();
			sessao = factory.openSession();
		}
		
		return sessao;
	}
}

